<template>
  <div>
    <div id="page">
      <!-- 头部 -->
      <header>
        <!-- <span class="iconfont">&#xe6bc;</span> -->
        <v-back></v-back>
        <h2>手机登入</h2>
        <p>
          <span class="iconfont">&#xf0112;</span>
          <span class="iconfont">&#xe71e;</span>
          <i></i>
        </p>
      </header>
      <main>
        <h1>
          <img src="../../assets/images/logo.jpg" alt="">
        </h1>
        <p><i>手机号</i><input class="phone_number" type="text" v-model="form.phone"></p>
        <p><i>昵&nbsp;&nbsp;&nbsp;&nbsp;称</i><input class="code" type="text" v-model="form.nickname"></p>
        <p><i>密&nbsp;&nbsp;&nbsp;&nbsp;码</i><input class="code" type="text" v-model="form.password"></p>
        <button class="enter" @click="submit">注册</button>
                <span class="login"
          >已有账号？ <router-link to="/login">去登录</router-link>
        </span>
      </main>
    </div>
  </div>
</template>

<script>
import {register} from "../../request/api"
  export default {
    data(){
      return{
        form:{
          phone:"",
          nickname:"",
          password:""
        }
      }
    },
    methods:{
      submit(){
        register(this.form).then(res=>{
          if(res.data.code==200){
            this.Toast.success(res.data.msg)
            this.$router.push("/login")
          }else{
            this.Toast.dail(res.data.msg)
          }
        })
      }
    }
  }
</script>

<style scoped>
.login {
  display: inline-block;
  padding: 0.2rem 0 0 0.5rem;
}
.login a {
  text-decoration: underline;
  color: #ff6040;
}
html,
body,
#page {
  height: 100%;
}
#page {
  max-width: 7.5rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
/*头部*/
header {
  height: 0.8rem;
  background: #ff6040;
  display: flex;
  color: #ffdfd8;
  padding: 0.3rem 0.12rem 0.12rem 0.33rem;
  align-items: center;
  margin-bottom: 0.2rem;
}
header h2 {
  font-size: 0.3rem;
  margin: 0 1.2rem 0 2.5rem;
}
header p {
  width: 1.72rem;
  height: 0.62rem;
  border: 1px solid #ff876c;
  border-radius: 0.31rem;
  line-height: 0.62rem;
  display: flex;
  justify-content: space-between;
  position: relative;
}
header p span {
  width: 0.86rem;
  text-align: center;
}
header p i {
  width: 1px;
  height: 0.37rem;
  background: #ff876c;
  position: absolute;
  left: 0.86rem;
  top: 0.12rem;
}
/*主体*/
main {
  flex: 1;
  overflow: auto;
  width: 95%;
  background: #fff;
  margin: 0 auto;
  padding: 4.87rem 0 1rem;
  margin-bottom: 0.87rem;
}
main h1 {
  width: 3.65rem;
  margin: 0 auto;
  margin-bottom: 0.4rem;
}
main h1 img {
  width: 100%;
  display: block;
}
main p {
  width: 6.1rem;
  height: 0.98rem;
  border-bottom: 1px solid #f7f7f7;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
main p span {
  width: 1.6rem;
  height: 0.48rem;
  background: #cccccc;
  text-align: center;
  line-height: 0.48rem;
}
main p .phone_number {
  border: none;
 width: 5rem;
  height: 0.98rem;
}
main p .code {
  border: none;
  height: 0.98rem;
  width: 5rem;
}
main .enter {
  width: 6.1rem;
  height: 0.98rem;
  background: #cccccc;
  margin: 0 auto;
  display: block;
  line-height: 0.98rem;
  color: #fff;
  font-weight: bold;
  font-size: 0.3rem;
  text-align: center;
  margin-top: 0.4rem;
  border: none;
}

</style>